Skip to content

Avoids recomputing LineEnding.toUnix in Formatter step loop#2934

Merged
nedtwigg merged 4 commits into
diffplug:mainfrom
mirkoalicastro:perf/formatter-reuse-normalized-content
May 18, 2026
Merged

Avoids recomputing LineEnding.toUnix in Formatter step loop#2934
nedtwigg merged 4 commits into
diffplug:mainfrom
mirkoalicastro:perf/formatter-reuse-normalized-content

Conversation

@mirkoalicastro
Copy link
Copy Markdown
Contributor

In the core format loop, when a formatting step changes a file's content, the code used to normalize line endings to Unix twice in a row on the same content: once to compare, then again one more time to store. The loop runs once per step, per file. toUnix scans the whole file. This PR fixes it to reuse the first result instead of computing it a second time, with no changes in the behavior.

@nedtwigg nedtwigg merged commit e5152fa into diffplug:main May 18, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants